<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
use Hyperf\Database\Migrations\Migration;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::dropIfExists('users');
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('nick_name')->default('')->comment('昵称');
            $table->string('real_name')->default('')->comment('昵称');
            $table->string('avatar')->default('')->comment('头像');
            $table->string('mobile')->default('')->comment('手机号码');
            $table->string('sex')->default('保密')->comment('性别： 先生 女士 保密 ');
            $table->string('address')->default('')->comment('地址');
            $table->timestamp('birthday')->nullable()->comment('生日');
            $table->string('password_plaintext', 500)->default('')->comment('密码');
            $table->string('password', 500)->default('')->comment('密码');
            $table->string('user_agent', 2000)->default('')->comment('设备信息');
            $table->string('last_login_ip')->default()->comment('最后登录ip');
            $table->timestamp('last_login_at')->default('2020-01-01')->comment('最后登录时间');
            $table->string('invite_code')->default('')->comment('用户邀请码');
            $table->string('register_id')->default('')->comment('极光推送id');
            $table->tinyInteger('is_ban')->default(2)->comment('是否封印 1是 2否');
            $table->tinyInteger('is_share')->default(1)->comment('是否允许分享 1是 2否');
            $table->timestamps();
            $table->softDeletes();
            $table->comment('用户表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
        });
    }
}
